<?php

namespace catchAdmin\apipatient\validate;

use think\Validate;

class HealthDiary extends Validate
{
    protected $rule = [
        'data_type|类型' => [
            'require',
            'in:bloodSugar,bloodPressure,BMI'
        ],
        'timeFrame|时段' => [
            'requireIf:data_type,bloodSugar',
            'in:凌晨,空腹,早餐后,午餐前,午餐后,晚餐前,晚餐后,睡前'
        ],
        'bloodSugar|血糖值' => [
            'requireIf:data_type,bloodSugar',
            'float'
        ],
        'highPressure|收缩压' => [
            'requireIf:data_type,bloodPressure',
            'integer'
        ],
        'diastolicPressure|舒张压' => [
            'requireIf:data_type,bloodPressure',
            'integer'
        ],
        'heartRate|心率' => [
            'requireIf:data_type,bloodPressure',
            'integer'
        ],
        'height|身高' => [
            'requireIf:data_type,BMI',
            'float'
        ],
        'weight|体重' => [
            'requireIf:data_type,BMI',
            'float'
        ],
    ];
    protected $scene = [
        "create_data" => ["data_type", "timeFrame", "bloodSugar", "highPressure", "diastolicPressure", "heartRate", "height", "weight"]
    ];
}